import {goodsList} from '@/network/api'

const state = {
  seachList: {}
};
const mutations = {
  GETSRACHLIST(state,seachList){
    state.seachList = seachList
  }
};
const actions = {
//获取seach数据
async getSeachList({commit},params={}){
  let result = await goodsList(params)
  if(result.code == 200){
    commit('GETSRACHLIST',result.data)
  }
}
};
//计算属性、简化数据
const getters = {
  attrsList(state){
    return state.seachList.attrsList;
  },
  goodsList(state){
    return state.seachList.goodsList||[];
  },
  trademarkList(state){
    return state.seachList.trademarkList;
  }
};

//vuex模块化开发
export default {
  state,
  mutations,
  actions,
  getters
}